import 'package:flutter/material.dart';
import 'package:x3_base_package/x3_base_package.dart';
import 'package:x3_business_core/business_retails/components/business_retails_order_item.dart';

class BusinessCustomerDetailsOrder extends StatelessWidget {

  static final String sName = 'vip/myretail';

  final BaseRefreshController _controller = new BaseRefreshController();

  @override
  Widget build(BuildContext context) {
    dynamic arguments = BaseRouterUtil.getArguments(context);
    String vipId = BaseUtils.getKeyData(arguments, 'vipId').toString();
    return BaseScaffoldComponent(
      title: '成交订单',
      child: Column(
        children: [
          _buildSearchComponent(),
          Expanded(child: _buildListContent(vipId, context)),
        ],
      ),
    );
  }

  Widget _buildListContent(String vipId, BuildContext context) {
    Map<String, dynamic> params = { 'vipId': vipId };
    String service = '/x3-service-vip-center/vip/customer/query/runwater/myorder';
    return BaseRefreshComponent(
      path: service,
      params: params,
      buildItem: (Map<String, dynamic> item, int index) => BusinessRetailsOrderItem(styleItem: item),
      controller: _controller,
    );
  }

  BaseSearchFilterComponent _buildSearchComponent() {
    return BaseSearchFilterComponent.appBar(onEditingComplete: (String value) =>  this._controller.refresh(params: {'searchKey': value}), hintText: '请输入单号搜索');
  }

}
